package Map;

/**
 * Stores all the data for nodes and provides methods for individual node operations.
 *
 * @author Lewis Marhin and John Gray-Spence
 */
public class Node {

    static int nodeCount = 0;
    private String desc;
    private int xLoc;
    private int yLoc;
    private Node parent;

    /**
     * Constructor for the Node class
     *
     * @param desc String containing the text that appears in the node.
     * @param locXInt x coordinate of bubble.
     * @param locYInt y coordinate of bubble.
     */
    Node(String descString, int locXInt, int locYInt) {
        int id = nodeCount;
        nodeCount++;
        desc = descString;
        xLoc = locXInt;
        yLoc = locYInt;
    }

    /**
     * Non Default constructor for the Node class
     *
     * @param descString String containing the text that appears in the node.
     * @param locXInt Specifies x coordinate of node.
     * @param locYInt Specifies y coordinate of node.
     * @param startMode Specifies mode that new node should start with.
     * @param parentNode The node that the new one will connect to as a child.
     */
    Node(String descString, int locXInt, int locYInt, Node parentNode) {
        int id = nodeCount;
        nodeCount++;
        desc = descString;
        xLoc = locXInt;
        yLoc = locYInt;
        parent = parentNode;
    }

    /**
     * Returns a string containg the text that appears on the node.
     *
     * @return Text on node.
     */
    public String getDesc() {
        return desc;
    }

    /**
     * Sets the text that appears on the node.
     *
     * @param s The text to appear on the node.
     */
    public void setDesc(String s) {
        desc = s;
    }

    /**
     * Alters the x location of the current node.
     *
     * @param x x coordinate of the node.
     */
    public void setXloc(int x) {
        xLoc = x;
    }

    /**
     * Returns the current x coordinate of hte node.
     *
     * @return x coordinate.
     */
    public int getXloc() {
        return xLoc;
    }

    /**
     * Alters the y location of the current node.
     *
     * @param y y coordinate of the of the node.
     */
    public void setYloc(int y) {
        yLoc = y;
    }

    /**
     * Returns the current y coodinate of the node.
     *
     * @return y coordinate.
     */
    public int getYloc() {
        return yLoc;
    }

    /**
     * Returns the parent node of the current node.
     *
     * @return Parent node.
     */
    public Node getParent() {
        return parent;
    }
}
